/**
 * @author		Sergey Suzdalskiy
 * @e-mail:		sergey.suzdalskiy@gmail.com
 */
package ua.kiev.gcore.ui.controls
{
	import flash.display.MovieClip;
	import flash.display.Sprite;
	
	public class ProgressBar extends Sprite
	{
		protected var backGround:MovieClip;
		private var _value:int;
		
		public function ProgressBar(BackGroundClass:Class)
		{
			super();
			backGround = new BackGroundClass();
			addChild(backGround);
			backGround.gotoAndStop(1);
		}
		
		/** i = [0;100] **/
		public function set value(i:int):void{
			if(i != value){
				if((i > 0)&&(i<101)){
					if(i <= 0){
						i = 1;
					}
					if(i > 100){
						i = 100;
					}
				}
				_value = i;
				if(backGround){
					backGround.gotoAndStop(value);
				}
			}
		}
		public function get value():int{
			return _value;
		}
	}
}